import {Message} from 'element-ui'
import store from '@/store'

export default {
  inserted(el, binding, vnode) {
    const { value } = binding
    const permissions = store.state.permissions;
//  const permissions = ['data/indexdata/add'];

    if (value) {
      const permissionFlag = value
      //判断是否存在
      const hasPermissions = permissions.some(item => {
        return item == permissionFlag
      })
      		//无权限按钮
		      if (!hasPermissions) {
//			      	Message({
//					      message: `您没有${el.innerText}的操作权限标签值`,
//					      type: 'error',
//							});
		        el.parentNode && el.parentNode.removeChild(el)
		      }
    }
  }
}
